home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / TextServices.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  12.1 KB  |  365 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        TextServices.h
  3.  
  4.      Contains:    Text Services Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 8.2
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1991-1999 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __TEXTSERVICES__
  18. #define __TEXTSERVICES__
  19.  
  20. #ifndef __CONDITIONALMACROS__
  21.     #include <ConditionalMacros.h>
  22. #endif
  23.  
  24. #ifndef __MACTYPES__
  25.     #include <MacTypes.h>
  26. #endif
  27.  
  28. #ifndef __EVENTS__
  29.     #include <Events.h>
  30. #endif
  31.  
  32. #ifndef __MENUS__
  33.     #include <Menus.h>
  34. #endif
  35.  
  36. #ifndef __AEDATAMODEL__
  37.     #include <AEDataModel.h>
  38. #endif
  39.  
  40. #ifndef __AEREGISTRY__
  41.     #include <AERegistry.h>
  42. #endif
  43.  
  44. #ifndef __COMPONENTS__
  45.     #include <Components.h>
  46. #endif
  47.  
  48.  
  49.  
  50.  
  51. #if PRAGMA_ONCE
  52. #pragma once
  53. #endif
  54.  
  55. #ifdef __cplusplus
  56. extern "C" {
  57. #endif
  58.  
  59. #if PRAGMA_IMPORT
  60. #pragma import on
  61. #endif
  62.  
  63. #if PRAGMA_STRUCT_ALIGN
  64.     #pragma options align=mac68k
  65. #elif PRAGMA_STRUCT_PACKPUSH
  66.     #pragma pack(push, 2)
  67. #elif PRAGMA_STRUCT_PACK
  68.     #pragma pack(2)
  69. #endif
  70.  
  71. enum {
  72.     kTextService                = FOUR_CHAR_CODE('tsvc'),        /* component type for the component description */
  73.     kInputMethodService            = FOUR_CHAR_CODE('inpm'),        /* component subtype for the component description */
  74.     kTSMVersion                    = 0x0150                        /* Version of the Text Services Manager is 1.5 */
  75. };
  76.  
  77. enum {
  78.     kUnicodeDocument            = FOUR_CHAR_CODE('udoc'),        /* TSM Document type for Unicode-savvy application */
  79.     kUnicodeTextService            = FOUR_CHAR_CODE('utsv')        /* Component type for Unicode Text Service */
  80. };
  81.  
  82. /* Language and Script constants*/
  83. enum {
  84.     kUnknownLanguage            = 0xFFFF,
  85.     kUnknownScript                = 0xFFFF,
  86.     kNeutralScript                = 0xFFFF
  87. };
  88.  
  89.  
  90. enum {
  91.                                                                 /* Component Flags in ComponentDescription */
  92.     bTakeActiveEvent            = 15,                            /* bit set if the component takes active event */
  93.     bHandleAERecording            = 16,                            /* bit set if the component takes care of recording Apple Events <new in vers2.0> */
  94.     bScriptMask                    = 0x00007F00,                    /* bit 8 - 14 */
  95.     bLanguageMask                = 0x000000FF,                    /* bit 0 - 7  */
  96.     bScriptLanguageMask            = bScriptMask + bLanguageMask    /* bit 0 - 14  */
  97. };
  98.  
  99. enum {
  100.                                                                 /* Typing method property constants for Input Methods */
  101.     kIMJaTypingMethodProperty    = FOUR_CHAR_CODE('jtyp'),        /* Typing method property for Japanese input methods*/
  102.     kIMJaTypingMethodRoman        = FOUR_CHAR_CODE('roma'),        /* Roman typing*/
  103.     kIMJaTypingMethodKana        = FOUR_CHAR_CODE('kana')        /* Kana typing*/
  104. };
  105.  
  106. enum {
  107.                                                                 /* Low level routines which are dispatched directly to the Component Manager */
  108.     kCMGetScriptLangSupport        = 0x0001,                        /* Component Manager call selector 1 */
  109.     kCMInitiateTextService        = 0x0002,                        /* Component Manager call selector 2 */
  110.     kCMTerminateTextService        = 0x0003,                        /* Component Manager call selector 3 */
  111.     kCMActivateTextService        = 0x0004,                        /* Component Manager call selector 4 */
  112.     kCMDeactivateTextService    = 0x0005,                        /* Component Manager call selector 5 */
  113.     kCMTextServiceEvent            = 0x0006,                        /* Component Manager call selector 6 */
  114.     kCMGetTextServiceMenu        = 0x0007,                        /* Component Manager call selector 7 */
  115.     kCMTextServiceMenuSelect    = 0x0008,                        /* Component Manager call selector 8 */
  116.     kCMFixTextService            = 0x0009,                        /* Component Manager call selector 9 */
  117.     kCMSetTextServiceCursor        = 0x000A,                        /* Component Manager call selector 10 */
  118.     kCMHidePaletteWindows        = 0x000B,                        /* Component Manager call selector 11 */
  119.     kCMGetTextServiceProperty    = 0x000C,                        /* Component Manager call selector 12 */
  120.     kCMSetTextServiceProperty    = 0x000D                        /* Component Manager call selector 13 */
  121. };
  122.  
  123. enum {
  124.                                                                 /* New low level routines which are dispatched directly to the Component Manager */
  125.     kCMUCTextServiceEvent        = 0x000E                        /* Component Manager call selector 14 */
  126. };
  127.  
  128.  
  129. /* extract Script/Language code from Component flag ... */
  130. #define        mGetScriptCode(cdRec)        ((ScriptCode)    ((cdRec.componentFlags & bScriptMask) >> 8))
  131. #define        mGetLanguageCode(cdRec)        ((LangCode)        cdRec.componentFlags & bLanguageMask)
  132.  
  133. /* New opaque definitions for types */
  134. typedef struct OpaqueTSMDocumentID*     TSMDocumentID;
  135. typedef OSType                             InterfaceTypeList[1];
  136.  
  137. /* Text Service Info List */
  138.  
  139. struct TextServiceInfo {
  140.     Component                         fComponent;
  141.     Str255                             fItemName;
  142. };
  143. typedef struct TextServiceInfo            TextServiceInfo;
  144. typedef TextServiceInfo *                TextServiceInfoPtr;
  145.  
  146. struct TextServiceList {
  147.     short                             fTextServiceCount;            /* number of entries in the 'fServices' array */
  148.     TextServiceInfo                 fServices[1];                /* Note: array of 'TextServiceInfo' records follows */
  149. };
  150. typedef struct TextServiceList            TextServiceList;
  151. typedef TextServiceList *                TextServiceListPtr;
  152. typedef TextServiceListPtr *            TextServiceListHandle;
  153.  
  154. struct ScriptLanguageRecord {
  155.     ScriptCode                         fScript;
  156.     LangCode                         fLanguage;
  157. };
  158. typedef struct ScriptLanguageRecord        ScriptLanguageRecord;
  159.  
  160. struct ScriptLanguageSupport {
  161.     short                             fScriptLanguageCount;        /* number of entries in the 'fScriptLanguageArray' array */
  162.     ScriptLanguageRecord             fScriptLanguageArray[1];    /* Note: array of 'ScriptLanguageRecord' records follows */
  163. };
  164. typedef struct ScriptLanguageSupport    ScriptLanguageSupport;
  165. typedef ScriptLanguageSupport *            ScriptLanguageSupportPtr;
  166. typedef ScriptLanguageSupportPtr *        ScriptLanguageSupportHandle;
  167. /* High level TSM Doucment routines */
  168. EXTERN_API( OSErr )
  169. NewTSMDocument                    (short                     numOfInterface,
  170.                                  InterfaceTypeList         supportedInterfaceTypes,
  171.                                  TSMDocumentID *        idocID,
  172.                                  long                     refcon)                                TWOWORDINLINE(0x7000, 0xAA54);
  173.  
  174. EXTERN_API( OSErr )
  175. DeleteTSMDocument                (TSMDocumentID             idocID)                                TWOWORDINLINE(0x7001, 0xAA54);
  176.  
  177. EXTERN_API( OSErr )
  178. ActivateTSMDocument                (TSMDocumentID             idocID)                                TWOWORDINLINE(0x7002, 0xAA54);
  179.  
  180. EXTERN_API( OSErr )
  181. DeactivateTSMDocument            (TSMDocumentID             idocID)                                TWOWORDINLINE(0x7003, 0xAA54);
  182.  
  183. EXTERN_API( OSErr )
  184. FixTSMDocument                    (TSMDocumentID             idocID)                                TWOWORDINLINE(0x7007, 0xAA54);
  185.  
  186. EXTERN_API( OSErr )
  187. GetServiceList                    (short                     numOfInterface,
  188.                                  OSType *                supportedInterfaceTypes,
  189.                                  TextServiceListHandle * serviceInfo,
  190.                                  long *                    seedValue)                            TWOWORDINLINE(0x7008, 0xAA54);
  191.  
  192. EXTERN_API( OSErr )
  193. OpenTextService                    (TSMDocumentID             idocID,
  194.                                  Component                 aComponent,
  195.                                  ComponentInstance *    aComponentInstance)                    TWOWORDINLINE(0x7009, 0xAA54);
  196.  
  197. EXTERN_API( OSErr )
  198. CloseTextService                (TSMDocumentID             idocID,
  199.                                  ComponentInstance         aComponentInstance)                    TWOWORDINLINE(0x700A, 0xAA54);
  200.  
  201. EXTERN_API( OSErr )
  202. SendAEFromTSMComponent            (const AppleEvent *        theAppleEvent,
  203.                                  AppleEvent *            reply,
  204.                                  AESendMode             sendMode,
  205.                                  AESendPriority         sendPriority,
  206.                                  long                     timeOutInTicks,
  207.                                  AEIdleUPP                 idleProc,
  208.                                  AEFilterUPP             filterProc)                            TWOWORDINLINE(0x700B, 0xAA54);
  209.  
  210. EXTERN_API( OSErr )
  211. SetDefaultInputMethod            (Component                 ts,
  212.                                  ScriptLanguageRecord *    slRecordPtr)                        TWOWORDINLINE(0x700C, 0xAA54);
  213.  
  214. EXTERN_API( OSErr )
  215. GetDefaultInputMethod            (Component *            ts,
  216.                                  ScriptLanguageRecord *    slRecordPtr)                        TWOWORDINLINE(0x700D, 0xAA54);
  217.  
  218. EXTERN_API( OSErr )
  219. SetTextServiceLanguage            (ScriptLanguageRecord *    slRecordPtr)                        TWOWORDINLINE(0x700E, 0xAA54);
  220.  
  221. EXTERN_API( OSErr )
  222. GetTextServiceLanguage            (ScriptLanguageRecord *    slRecordPtr)                        TWOWORDINLINE(0x700F, 0xAA54);
  223.  
  224. EXTERN_API( OSErr )
  225. UseInputWindow                    (TSMDocumentID             idocID,
  226.                                  Boolean                 useWindow)                            TWOWORDINLINE(0x7010, 0xAA54);
  227.  
  228. #if CALL_NOT_IN_CARBON
  229. /* Following calls from Classic event loops not needed for Carbon clients. */
  230. EXTERN_API( Boolean )
  231. TSMEvent                        (EventRecord *            event)                                TWOWORDINLINE(0x7004, 0xAA54);
  232.  
  233. EXTERN_API( Boolean )
  234. TSMMenuSelect                    (long                     menuResult)                            TWOWORDINLINE(0x7005, 0xAA54);
  235.  
  236. EXTERN_API( Boolean )
  237. SetTSMCursor                    (Point                     mousePos)                            TWOWORDINLINE(0x7006, 0xAA54);
  238.  
  239. /* Following ServiceWindow API replaced by Window Manager API in Carbon. */
  240. EXTERN_API( OSErr )
  241. NewServiceWindow                (void *                    wStorage,
  242.                                  const Rect *            boundsRect,
  243.                                  ConstStr255Param         title,
  244.                                  Boolean                 visible,
  245.                                  short                     theProc,
  246.                                  WindowPtr                 behind,
  247.                                  Boolean                 goAwayFlag,
  248.                                  ComponentInstance         ts,
  249.                                  WindowPtr *            window)                                TWOWORDINLINE(0x7011, 0xAA54);
  250.  
  251. EXTERN_API( OSErr )
  252. CloseServiceWindow                (WindowPtr                 window)                                TWOWORDINLINE(0x7012, 0xAA54);
  253.  
  254. EXTERN_API( OSErr )
  255. GetFrontServiceWindow            (WindowPtr *            window)                                TWOWORDINLINE(0x7013, 0xAA54);
  256.  
  257. EXTERN_API( short )
  258. FindServiceWindow                (Point                     thePoint,
  259.                                  WindowPtr *            theWindow)                            TWOWORDINLINE(0x7017, 0xAA54);
  260.  
  261. EXTERN_API( OSErr )
  262. NewCServiceWindow                (void *                    wStorage,
  263.                                  const Rect *            boundsRect,
  264.                                  ConstStr255Param         title,
  265.                                  Boolean                 visible,
  266.                                  short                     theProc,
  267.                                  WindowPtr                 behind,
  268.                                  Boolean                 goAwayFlag,
  269.                                  ComponentInstance         ts,
  270.                                  WindowPtr *            window)                                TWOWORDINLINE(0x701A, 0xAA54);
  271.  
  272. /* Explicit initialization not needed for Carbon clients, since TSM is */
  273. /* instanciated per-context. */
  274. EXTERN_API( OSErr )
  275. InitTSMAwareApplication            (void)                                                        TWOWORDINLINE(0x7014, 0xAA54);
  276.  
  277. EXTERN_API( OSErr )
  278. CloseTSMAwareApplication        (void)                                                        TWOWORDINLINE(0x7015, 0xAA54);
  279.  
  280. #endif  /* CALL_NOT_IN_CARBON */
  281.  
  282. /* Component Manager Interfaces to Input Methods */
  283. EXTERN_API( ComponentResult )
  284. GetScriptLanguageSupport        (ComponentInstance         ts,
  285.                                  ScriptLanguageSupportHandle * scriptHdl)                    FIVEWORDINLINE(0x2F3C, 0x0004, 0x0001, 0x7000, 0xA82A);
  286.  
  287. EXTERN_API( ComponentResult )
  288. InitiateTextService                (ComponentInstance         ts)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x0002, 0x7000, 0xA82A);
  289.  
  290. EXTERN_API( ComponentResult )
  291. TerminateTextService            (ComponentInstance         ts)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x0003, 0x7000, 0xA82A);
  292.  
  293. EXTERN_API( ComponentResult )
  294. ActivateTextService                (ComponentInstance         ts)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x0004, 0x7000, 0xA82A);
  295.  
  296. EXTERN_API( ComponentResult )
  297. DeactivateTextService            (ComponentInstance         ts)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x0005, 0x7000, 0xA82A);
  298.  
  299. EXTERN_API( ComponentResult )
  300. GetTextServiceMenu                (ComponentInstance         ts,
  301.                                  MenuRef *                serviceMenu)                        FIVEWORDINLINE(0x2F3C, 0x0004, 0x0007, 0x7000, 0xA82A);
  302.  
  303. #if CALL_NOT_IN_CARBON
  304. EXTERN_API( ComponentResult )
  305. TextServiceEvent                (ComponentInstance         ts,
  306.                                  short                     numOfEvents,
  307.                                  EventRecord *            event)                                FIVEWORDINLINE(0x2F3C, 0x0006, 0x0006, 0x7000, 0xA82A);
  308.  
  309. EXTERN_API( ComponentResult )
  310. UCTextServiceEvent                (ComponentInstance         ts,
  311.                                  short                     numOfEvents,
  312.                                  EventRecord *            event,
  313.                                  UniChar                 unicodeString[],
  314.                                  UniCharCount             unicodeStrLength)                    FIVEWORDINLINE(0x2F3C, 0x000E, 0x000E, 0x7000, 0xA82A);
  315.  
  316. EXTERN_API( ComponentResult )
  317. TextServiceMenuSelect            (ComponentInstance         ts,
  318.                                  MenuRef                 serviceMenu,
  319.                                  short                     item)                                FIVEWORDINLINE(0x2F3C, 0x0006, 0x0008, 0x7000, 0xA82A);
  320.  
  321. EXTERN_API( ComponentResult )
  322. SetTextServiceCursor            (ComponentInstance         ts,
  323.                                  Point                     mousePos)                            FIVEWORDINLINE(0x2F3C, 0x0004, 0x000A, 0x7000, 0xA82A);
  324.  
  325. #endif  /* CALL_NOT_IN_CARBON */
  326.  
  327. EXTERN_API( ComponentResult )
  328. FixTextService                    (ComponentInstance         ts)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x0009, 0x7000, 0xA82A);
  329.  
  330. EXTERN_API( ComponentResult )
  331. HidePaletteWindows                (ComponentInstance         ts)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x000B, 0x7000, 0xA82A);
  332.  
  333. EXTERN_API( ComponentResult )
  334. GetTextServiceProperty            (ComponentInstance         ts,
  335.                                  OSType                 propertySelector,
  336.                                  SInt32 *                result)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x000C, 0x7000, 0xA82A);
  337.  
  338. EXTERN_API( ComponentResult )
  339. SetTextServiceProperty            (ComponentInstance         ts,
  340.                                  OSType                 propertySelector,
  341.                                  SInt32                 value)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x000D, 0x7000, 0xA82A);
  342.  
  343.  
  344.  
  345. #if PRAGMA_STRUCT_ALIGN
  346.     #pragma options align=reset
  347. #elif PRAGMA_STRUCT_PACKPUSH
  348.     #pragma pack(pop)
  349. #elif PRAGMA_STRUCT_PACK
  350.     #pragma pack()
  351. #endif
  352.  
  353. #ifdef PRAGMA_IMPORT_OFF
  354. #pragma import off
  355. #elif PRAGMA_IMPORT
  356. #pragma import reset
  357. #endif
  358.  
  359. #ifdef __cplusplus
  360. }
  361. #endif
  362.  
  363. #endif /* __TEXTSERVICES__ */
  364.  
  365.